package com.smartwebx.ha.web.gis.module.screen;

import java.text.ParseException;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;

import com.smartwebx.ha.biz.assign.HaAreaManager;
import com.smartwebx.ha.biz.rainwater.real.RiverManager;
import com.smartwebx.ha.biz.rainwater.real.WaterInfoManager;
import com.smartwebx.ha.dal.annot.JsonModule;
import com.smartwebx.ha.dal.annot.JsonModules;
import com.smartwebx.ha.dal.assign.bean.HaArea;
import com.smartwebx.ha.dal.usebean.GisWater;
import com.smartwebx.ha.web.admin.common.HaUserSys;
import com.smartwebx.ha.web.util.json.module.DateModule;
import com.smartwebx.ha.web.util.json.module.DoubleModule;

public class WaterInfoScreen extends BasicScreen {
	@Autowired
	private WaterInfoManager waterInfoManager;
	@Autowired
	private RiverManager riverManager;
	@Autowired
	private HaAreaManager haAreaManager;
	@Autowired
	private HttpSession session;

	/**
	 * 获得最新水情信息
	 * 
	 * @param tm
	 *            (2010-03-25) 查询时间点
	 * @return
	 * @throws ParseException
	 */
	@JsonModules({ @JsonModule(clazz = DateModule.class, value = "yyyy-MM-dd"),
			@JsonModule(clazz = DoubleModule.class, value = "2") })
	public List<GisWater> getLatestRiverGisInfo(Date tm) throws ParseException {
		HaUserSys loginUser = (HaUserSys) session.getAttribute("haUser");
		HaArea area = haAreaManager.findOne(loginUser.getAreaId());
		List<GisWater> gisWaters = waterInfoManager.getLatestRiverGisInfo(tm,
				area);
		return gisWaters;
	}
}
